package com.nulldev.util.graphics.renderIt.api.demos;

import java.awt.Component;

import javax.swing.JFrame;

import com.nulldev.util.graphics.renderIt.api.renderItAPI;
import com.nulldev.util.graphics.renderIt.api.renderItGraphicsInterface;
import com.nulldev.util.graphics.renderIt.api.core.IRenderCallback;
import com.nulldev.util.graphics.renderIt.api.core.IRenderCallbackMetadata;
import com.nulldev.util.graphics.renderIt.api.core.IRenderCanvas;
import com.nulldev.util.graphics.renderIt.api.core.renderItOutputType;
import com.nulldev.util.graphics.renderIt.renderer.global.rColors;

public class RaisedRect3DDemo {

	public static void main(String[] args) {
		final JFrame jfr = new JFrame("rIt! Demo: RaisedRect3D");
		jfr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jfr.setLayout(new java.awt.BorderLayout(0, 0));
		final IRenderCanvas ic = renderItAPI.make_instance(renderItOutputType.RIT_OUTPUT_TYPE_AWT_FRAME, jfr);
		jfr.add((Component) ic.asAWTComponent());
		jfr.setBounds(50, 50, 400, 400);
		jfr.setVisible(true);
		ic.setRenderCallback(new IRenderCallback() {

			@Override
			public void onRender(final renderItGraphicsInterface iface, final IRenderCallbackMetadata metadata) {
				iface.bd_fillRect(0, 0, iface.viewport_getWidth(), iface.viewport_getHeight());
				iface.setColor(rColors.aquamarine);
				iface.rit_3d_fill_hRect(iface.createVector4f(0.1f, 0.1f, 0.5f, 0.5f), true);
			}
		});
		ic.start();
	}

}
